//
//  PZLSecondWebViewController.m
//  Various
//
//  Created by dllo on 16/3/29.
//  Copyright © 2016年 Harword. All rights reserved.
//

#import "PZLSecondWebViewController.h"

@interface PZLSecondWebViewController ()

@property (nonatomic, strong)UIWebView *webView;

@end

@implementation PZLSecondWebViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    [self creatWebView];
}



- (void)creatWebView{
    
    self.webView = [[UIWebView alloc] initWithFrame:CGRectMake(0, 0, sWEIGHT*414, sHEIGHT * 736)];
    
    NSString *path = self.temp;
    NSURL *url = [NSURL URLWithString:path];
    NSURLRequest *request = [NSURLRequest requestWithURL:url];
    
    self.webView.scalesPageToFit = YES;// 大小根据屏幕大小自动缩放
    self.webView.opaque = NO;// 不设置这个值页面始终是白色;
    [self.webView loadRequest:request];
    [self.view addSubview:self.webView];
    self.webView.scalesPageToFit = YES;
    
    [self.webView goBack];
    
    
    UIImage *image = [UIImage imageNamed:@"tqt_l_button"];
    // 取消渲染效果
    image = [image imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
    
    
    UIBarButtonItem *leftBarButton = [[UIBarButtonItem alloc] initWithImage:image style:UIBarButtonItemStylePlain target:self action:@selector(goBack)];
    self.navigationItem.leftBarButtonItem = leftBarButton;
}

- (void)goBack{
    if ([self.webView canGoBack]) {
        [self.webView goBack];
    }else{
        [self.navigationController popViewControllerAnimated:YES];
    }
}



- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    
}


@end
